/**
  CNOK project, Anyang Normal University, IMP-CAS
  \class TAAME
  \brief nucleus mass table. This is a singleton class.
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2022/03/15
  \date Last modified: 2022/03/16 by SUN Yazhou
  \copyright 2020-2023 SUN Yazhou
  \copyright CNOK project, Anyang Normal University, IMP-CAS
*/

#ifndef _TAAME_
#define _TAAME_

#include <string>
#include <map>
#include "TAException.h"

using std::string;
using std::map;

struct ame_t{
  int n, z, a;
  char el[3], name[6]; // element, EL+A
  double me, dme; // mass excess
  double be, dbe; // binding energy
  double ma, dma; // atomic mass
};

class TAAME{
public:
  static TAAME *Instance();
  virtual ~TAAME();

  double massATM(int z, int a) const; ///< \return atomic mass in MeV
  double massNUC(int z, int a) const; ///< \return nucleus mass in MeV
  const char *name(int z, int a) const;

protected:
  static TAAME *fInstance;
  map<int, map<int, ame_t>> fAME; // fAME[Z][A] = ame_t
  TAAME();
};

#endif
